<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='数据备份'}}
{{assign var="app" value='database'}}
{{assign var="act" value='index'}}
{{assign var="td" value='8'}}
<title>{{$title}}管理 - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
<script>
$(document).ready(function(){

    $('#backup').click(function(){//备份
        href_ = $(this).attr('href');
        if($('.check_id:checked').length==0) { ui.alert("至少选择一条数据!"); return false; }
        ui.confirm('当前选中'+$('.check_id:checked').length+'项，确定要备份这些表吗?',function(z){
            if(z){
                $('form[name=form]').attr('action',href_);
                $ajaxSubmit.ajaxSubmit($('form'));
            }
        },true);
        return false;
    });
    $('#optimize').click(function(){//优化
        if($('.check_id:checked').length==0) { ui.alert("至少选择一条数据!"); return false; }
        href_ = $(this).attr('href');
        ui.confirm('当前选中'+$('.check_id:checked').length+'项，确定要优化这些表吗?',function(z){
            if(z){
                $('form[name=form]').attr('action',href_);
                $ajaxSubmit.ajaxSubmit($('form'));
            }
        },true);
        return false;
    });
    $('#repair').click(function(){//修复
        if($('.check_id:checked').length==0) { ui.alert("至少选择一条数据!"); return false; }
        href_ = $(this).attr('href');
        ui.confirm('当前选中'+$('.check_id:checked').length+'项，确定要修复这些表吗?',function(z){
            if(z){
                $('form[name=form]').attr('action',href_);
                $ajaxSubmit.ajaxSubmit($('form'));
            }
        },true);
        return false;
    });
   
});
</script>
</head>
<body>

{{include file="include/sidebar.html"}}

<div class="body_right">
    <div id="content">

    <form name='form' class="ajaxSubmit" action="index.php?app={{$app}}" method="post">
    <table class="table table-bordered">
        <tr class="thead">
          <td colspan="{{$td}}">
              <div class="floatr">
                <a id="backup" class="btn btn-warning" href="index.php?app=database&act=export"><i class="icon-hdd"></i>立即备份</a>
                <a id="optimize" class="btn btn-info" href="index.php?app=database&act=optimize"><i class="icon-leaf"></i>优化表</a>
                <a id="repair" class="btn btn-success" href="index.php?app=database&act=repair"><i class="icon-retweet"></i>修复表</a>
              </div>
              ◆ {{$title}}管理 －> {{$title}}列表
          </td>
        </tr>
        {{if !$list}}
        <tr class="noline"><td colspan="{{$td}}" class="result_empty"></td></tr>
        {{else}}
        <tr class="ttitle">
            <th width="48"><input class="check_all" type="checkbox" value=""></th>
            <th>表名</th>
            <th>引擎 </th>
            <th width="120">数据量</th>
            <th width="120">数据大小</th>
            <th width="100">字符集</th>
            <th width="160">创建时间</th>
            <th width="180">操作</th>
        </tr>
        <tbody>
            {{foreach from=$list item=val key=key}}
            <tr>
                <td class="num">
                    <input class="check_id" type="checkbox" name="tables[]" value="{{$val.name}}">
                </td>
                <td>{{$val.name}}</td>
                <td>{{$val.engine}}</td>
                <td>{{$val.rows}}</td>
                <td>{{$val.data_length|getFileSize}}</td>
                <td>{{$val.collation}}</td>
                <td>{{$val.create_time}}</td>
                <td class="action">
                    <a class="btn ajaxSubmit btn-info" link="index.php?app=database&act=optimize&tables={{$val.name}}"><i class="icon-leaf"></i>优化表</a>
                    <a class="btn ajaxSubmit btn-success" link="index.php?app=database&act=repair&tables={{$val.name}}"><i class="icon-retweet"></i>修复表</a>
                </td>
            </tr>
            {{/foreach}}

            <tr class="thead">
              <td align="center" colspan="{{$td}}">
                <a class="check_all btn"><i class="icon-ok"></i>全选/反选</a>
              </td>
            </tr>
        </tbody>
        {{/if}}
    </table>
    </form>
</div>
</div>

</body>
</html>